home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
BARNET
/
FREENET
/
TRUSS
/
GRABNEWS
/
c
/
sockread
< prev
Wrap
Text File
|
1995-05-26
|
518b
|
29 lines
/* hist files named after #define HISTORY_FILE
* HISTORY_FILE/d.hist_? where ? is num or letter of first digit of id
*/
readsock()
{
static buf[1][BUF_SIZE]
static which_buf = 1;
set start time
which_buf = 1-which_buf; /* switch them over */
fill lower half of new buf from old buf
fix up indexes
while (1) {
if (cur_time-start_time <timeout) {
close socket we have nothing;
}
if (data vailavlbe) {
read into current buf
if contains '\n' {
strip cr-lf and return 0
}
}
}
}